"""
从1到2020中这些数字中有多少个2
"""
cnt = 0
for i in range(1,2021):
    cnt += (str(i).count('2'))

print("{}".format(cnt))
